import 'package:flutter/material.dart';

class EgGestureDetector extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("手势检测 演示"),
      ),
      body: new Center(
        child: new MyButton(),
      ),
    );
  }
}

class MyButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new GestureDetector(
      onTap: () {
        final snackBar = new SnackBar(content: new Text("您已按下"));
        Scaffold.of(context).showSnackBar(snackBar);
      },
      child: new Container(
        padding: EdgeInsets.all(12),
        decoration: new BoxDecoration(color: Theme.of(context).buttonColor, borderRadius: new BorderRadius.circular(10)),
        child: new Text("测试按钮"),
      ),
    );
  }
}
